package com.authine.cloudpivot.ext.service;

import com.alibaba.cola.dto.SingleResponse;
import com.authine.cloudpivot.ext.dto.kingDee.request.TemporaryDTO;
import com.authine.cloudpivot.ext.dto.kingDee.request.TemporaryInvoiceDTO;
import com.authine.cloudpivot.ext.kingdee.work.OtherWork;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import java.util.List;


/**
 * @Author: liwei
 * @DateTime: 2021/7/6
 * @Description: TODO 其他生成凭证服务
 */
@Slf4j
public class OtherVoucherService {

    private OtherWork otherService = new OtherWork();

    //    通过凭证列表ID删除该凭证：/delete/recording
    public SingleResponse deleteRecordingVoucherById( String id) {
        Assert.notNull(id, "通过凭证列表ID删除该凭证 入参数据为空");

        return otherService.deleteRecordingVoucherById(id);
    }

    //    通过凭证列表ID删除该凭证：/delete/recordings
    public SingleResponse deleteRecordingVoucherByIds( List<String> ids) {
        Assert.isTrue(!CollectionUtils.isEmpty(ids), "通过凭证列表ID删除该凭证 入参数据为空");

        return otherService.deleteRecordingVoucherByIds(ids);
    }

    //    开平台客户蓝票、红票、供应商服务费蓝票、红票暂存：/save/temporaryding
    public SingleResponse saveTemporary( TemporaryDTO temporaryDTO) {
        Assert.notNull(temporaryDTO, "开平台客户蓝票、红票、供应商服务费蓝票、红票暂存 入参数据为空");

        return otherService.saveTemporary(temporaryDTO);
    }

    //    开平台客户蓝票、红票、供应商服务费蓝票、红票暂存：/save/temporary/invoice
    public SingleResponse saveTemporaryInvoice( TemporaryInvoiceDTO temporaryInvoiceDTO) {
        Assert.notNull(temporaryInvoiceDTO, "开平台客户蓝票、红票、供应商服务费蓝票、红票暂存 入参数据为空");

        return otherService.saveTemporaryInvoice(temporaryInvoiceDTO);
    }

    //    通过凭证记录ID删除该凭证记录：/delete/voucher/
    public SingleResponse deleteVoucherById( List<String> ids) {
        Assert.isTrue(!CollectionUtils.isEmpty(ids), "通过凭证记录ID删除该凭证记录 入参数据为空");

        return otherService.deleteVoucherById(ids);
    }


}
